package service;

import dao.*;
import model.*;
import util.*;

public class UserService {
	private static UserService userService=new UserService();
	private UserService() {};
	public static UserService getInstance() {
		return userService;
	}
	private UserDao userDao=UserDao.getInstance();
	public boolean addUser(int uid,String password,String name,String sex,
			int age,String nationality,String fromCountry,String id) {
		User user=new User(uid, password, name, sex, age, nationality, fromCountry, id);
		if(userDao.insertUser(user)==true) {
			ShowMessage.show("注册成功！");
			return true;
		}else {
			ShowMessage.show("注册失败！可能是该账号已存在，您可以换一个账号试试");//sqlserver的unique唯一性约束
			return false;
		}
	}

}
